/* 
对books进行增删改查操作的model
*/

//引入mongoose
const mongoose = require('mongoose');

//定义文档结构 => 生成Schema对象,内部定义约束对象
const bookSchema = mongoose.Schema({
    name: String,
    author: String,
    price: Number
});

//生成Model,生成的集合会自动添加,并转为小写
const BookModel = mongoose.model('books', bookSchema);

//暴露BookModel
module.exports = BookModel;

